/**
 * The MOSES project, model based software engineering of networked embedded systems.
 * 
 * Copyright (C) 2010-2013, University of Applied Sciences Wildau,
 * Telematics Research Group, http://www.tm.th-wildau.de/research-group
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <http://www.gnu.org/licenses>.
 * 
 * Contributors:
 *     University of Applied Sciences Wildau - initial API and implementation
 * 
 * If you are interested in a commercial license please contact us via
 * e-mail: ralf.vandenhouten@th-wildau.de.
 */
package de.thwildau.tm.moses.asn1.generator;

import com.google.common.base.Objects;
import de.thwildau.tm.moses.asn1.util.EObjectResourceDescription;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.naming.QualifiedName;

/**
 * This Xtend class provides standard templates for Java class files.
 */
@SuppressWarnings("all")
public class JavaTemplates {
  public static CharSequence generatePackage(final EObjectResourceDescription<? extends Object> desc) {
    StringConcatenation _builder = new StringConcatenation();
    {
      QualifiedName _packageName = desc.getPackageName();
      boolean _notEquals = (!Objects.equal(_packageName, null));
      if (_notEquals) {
        _builder.append("package ");
        QualifiedName _packageName_1 = desc.getPackageName();
        String _string = _packageName_1.toString();
        _builder.append(_string, "");
        _builder.append(";");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.newLine();
    return _builder;
  }
  
  public static CharSequence generateDefaultImports() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.io.*;");
    _builder.newLine();
    _builder.append("import java.util.*;");
    _builder.newLine();
    _builder.append("import de.thwildau.tm.moses.asn1.lang.*;");
    _builder.newLine();
    _builder.newLine();
    return _builder;
  }
  
  public static CharSequence generateFileComment() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("/***********************************************************");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* This class was generated by the MOSES ASN.1 Compiler.");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* Created: ");
    DateFormat _instance = DateFormat.getInstance();
    Date _date = new Date();
    String _format = _instance.format(_date);
    _builder.append(_format, " ");
    _builder.newLineIfNotEmpty();
    _builder.append(" ");
    _builder.append("*");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* (c) ");
    Calendar _instance_1 = Calendar.getInstance();
    int _get = _instance_1.get(Calendar.YEAR);
    _builder.append(_get, " ");
    _builder.append(" Technische Hochschule Wildau");
    _builder.newLineIfNotEmpty();
    _builder.append(" ");
    _builder.append("* (University of Applied Sciences Wildau)");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* All rights reserved");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("***********************************************************/");
    _builder.newLine();
    return _builder;
  }
  
  public static CharSequence generateClassComment(final EObjectResourceDescription<? extends Object> desc) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("/**");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* This is a generated data type class for the ASN.1 type ");
    String _className = desc.getClassName();
    _builder.append(_className, " ");
    _builder.newLineIfNotEmpty();
    _builder.append(" ");
    _builder.append("* ");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* @generated");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("*/");
    _builder.newLine();
    return _builder;
  }
}
